<template>
	<view class="preview">
		<u-navbar title="预览资料" bgColor="#fff" class="nav" :placeholder="true" left-text="" @leftClick="onClickBack"
			:fixed="true" :safeAreaInsetTop="true">
		</u-navbar>
		<view class="content">
			<!-- 账号信息 -->
			<view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">账号信息</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>乐刷商户号</text>
					<text class="margin-left text-bold">{{userInfo.merchant_id || '暂无'}}</text>
				</view>

				<view class="margin-top-xs ">
					<text>登陆账号</text>
					<text class="margin-left-xl text-bold">{{username}}</text>
				</view>

			</view>


			<!-- 商户法人信息 -->
			<view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">商户法人信息</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>姓名</text>
					<text class="margin-left text-bold">{{legalPerson.legalName}}</text>
				</view>

				<view class="margin-top-xs">
					<text>证件类型</text>
					<text class="margin-left text-bold">身份证</text>
				</view>

				<view class="margin-top-xs">
					<text>证件号</text>
					<text class="margin-left-xl text-bold">{{legalPerson.idCardNo}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>有效期</text>
					<text class="margin-left-xl text-bold">{{legalPerson.idCardStart}} 至 {{legalPerson.idCardEnd}}</text>
				</view>

			</view>


			<!-- 结算信息 -->
			<view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">营业执照</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>证件类型</text>
					<text class="margin-left text-bold">营业执照</text>
				</view>

				<view class="margin-top-xs">
					<text>执照名称</text>
					<text class="margin-left-xl text-bold">{{licenseInfo.licenseFullName}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>执照编号</text>
					<text class="margin-left-xl text-bold">{{licenseInfo.license}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>有效期</text>
					<text class="margin-left-xl text-bold">{{licenseInfo.licenseStart}} 至 {{licenseInfo.licenseEnd}}</text>
				</view>
				<view class="margin-top-xs">
					<text>经营地址</text>
					<text class="margin-left text-bold">{{licenseInfo.licenseAddress}}</text>
				</view>

			</view>


			<!-- 结算信息 -->
			<view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">结算信息</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>开户名</text>
					<text class="margin-left text-bold">{{accountInfo.holder}}</text>
				</view>
				<view class="margin-top-xs">
					<text>开户支行</text>
					<text class="margin-left text-bold">{{branchName}}</text>
				</view>
				<!-- <view class="margin-top-xs">
					<text>开户号</text>
					<text class="margin-left text-bold">{{accountInfo.bankCardNo}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>开卡行</text>
					<text class="margin-left text-bold">{{accountInfo.branchName3}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>开卡省市</text>
					<text class="margin-left text-bold">{{accountInfo.branchCode1}} {{accountInfo.branchCode2}}</text>
				</view> -->
				
				<!-- <view class="margin-top-xs">
					<text>开卡网点</text>
					<text class="margin-left text-bold"></text>
				</view> -->
				
				<!-- <view class="margin-top-xs">
					<text>预留手机</text>
					<text class="margin-left text-bold"></text>
				</view> -->
				<view class="margin-top-xs">
					<text>证件类型</text>
					<text class="margin-left text-bold">身份证</text>
				</view>
				
				<view class="margin-top-xs">
					<text>证件号</text>
					<text class="margin-left text-bold">{{accountInfo.idCardNo}}</text>
				</view>
				
			</view>

			<!-- 经营信息 -->
			<view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">基础信息</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>商户简称</text>
					<text class="margin-left text-bold">{{baseInfo.merchantShortName}}</text>
				</view>

				<view class="margin-top-xs">
					<text>商户全称</text>
					<text class="margin-left text-bold">{{baseInfo.merchantName}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>所属行业</text>
					<text class="margin-left text-bold">{{mccName}}</text>
				</view>
				
				<view class="margin-top-xs">
					<text>手机号</text>
					<text class="margin-left text-bold">{{contactInfo.mobile}}</text>
				</view>
				<view class="margin-top-xs">
					<text>姓名</text>
					<text class="margin-left text-bold">{{contactInfo.name}}</text>
				</view>

			</view>

			<!-- 受益人信息 -->
			<!-- <view class="cu-bar bg-white margin-top">
				<view class="action">
					<text class="cuIcon-titles text-blue"></text>
					<text class="text-xl text-bold">受益人信息</text>
				</view>
			</view>

			<view class="margin-left">
				<view class="margin-top">
					<text>姓名</text>
					<text class="margin-left text-bold"></text>
				</view>

				<view class="margin-top-xs">
					<text>证件类型</text>
					<text class="margin-left text-bold"></text>
				</view>
				
				<view class="margin-top-xs">
					<text>证件号</text>
					<text class="margin-left text-bold"></text>
				</view>
				
				<view class="margin-top-xs margin-bottom-xl">
					<text>有效期</text>
					<text class="margin-left text-bold"></text>
				</view>

			</view> -->

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				userInfo: {},
				legalPerson: {},
				licenseInfo: {},
				accountInfo: {},
				addressInfo: {},
				shopInfo: {},
				baseInfo: {},
				contactInfo: {},
				mccName: '',
				branchName: ''
			}
		},
		onLoad() {
			this.userInfo = uni.getStorageSync("YNF_INFO")
			this.getDataInfo()
		},
		methods: {
			// 返回页面
			onClickBack() {
				uni.navigateBack()
			},
			getDataInfo () {
				this.legalPerson = uni.getStorageSync("legalPerson")
				this.licenseInfo = uni.getStorageSync("licenseInfo")
				this.accountInfo = uni.getStorageSync("accountInfo")
				this.addressInfo = uni.getStorageSync("addressInfo")
				this.shopInfo = uni.getStorageSync("shopInfo")
				this.baseInfo = uni.getStorageSync("baseInfo")
				this.contactInfo = uni.getStorageSync("contactInfo")
				this.getMccCode()
				this.getBankCard()
				this.username = this.baseInfo.merchantName
			},
			async getMccCode () {
				let params = {
					  'param[mccCode]': uni.getStorageSync("baseInfo").mccCode,
				}
				const res = await this.$API({url: '/api/user/mcc', method:"GET", data: params,})
				if (res.code === 1) {
					this.mccName = res.data.data[0].mccText
				}
				
				
			},
			async getBankCard () {
				let params = {
					"param[unionpayCode]": uni.getStorageSync("accountInfo").unionpay
				}
				const res = await this.$API({url: '/api/user/bankbranch2', method:"GET", data: params,})
				if(res.code === 1) {
					this.branchName = res.data.data.list[0].branchName
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.preview {
		padding-bottom: 20rpx;
	}
	page{
		background-color: #f8f8f8;
	}
	
</style>
